package Contr2;

import junit.framework.*;
import junit.textui.TestRunner;

public class TestFactory extends TestCase {
	Factory fab=new Factory();
	
	public TestFactory(String testName) {
        super(testName);
    }
	
	public void testIE() {				
		ICommandExcutor testIE=fab.getExecutor("");
		assertTrue(testIE==null);
	}
	
	public void testIEDir() {
		ICommandExcutor testIE=fab.getExecutor("dir");
		assertTrue(testIE instanceof DirCommandExcutor);
	}
	
	public void testIETree() {
		ICommandExcutor testIE=fab.getExecutor("tree");
		assertTrue(testIE instanceof TreeCommandExcutor);
	}
	
	public void testIEFind() {
		ICommandExcutor testIE=fab.getExecutor("find");
		assertTrue(testIE instanceof FindCommandExcutor);
	}
	
	public void testIEMkdir() {
		ICommandExcutor testIE=fab.getExecutor("mkdir");
		assertTrue(testIE instanceof MkdirCommandExcutor);
	}
	
	public void testIECopy() {
		ICommandExcutor testIE=fab.getExecutor("copy");
		assertTrue(testIE instanceof CopyCommandExcutor);
	}
	
	public void testIEMove() {
		ICommandExcutor testIE=fab.getExecutor("move");
		assertTrue(testIE instanceof MoveCommandExcutor);
	}
	
	public void testIEDelete() {
		ICommandExcutor testIE=fab.getExecutor("delete");
		assertTrue(testIE instanceof DeleteCommandExcutor);
	}
	
	public void testIEHelp() {
		ICommandExcutor testIE=fab.getExecutor("help");
		assertTrue(testIE instanceof HelpCommandExcutor);
	}
	
	public void testIECD() {
		ICommandExcutor testIE=fab.getExecutor("cd");
		assertTrue(testIE instanceof CDCommandExcutor);
	}
	
	public void testIEExit() {
		ICommandExcutor testIE=fab.getExecutor("exit");
		assertTrue(testIE instanceof ExitCommandExcutor);
	}
	
	public static void main(String[] args) {
	    TestRunner runner = new TestRunner();
	    TestSuite suite = new TestSuite();
	    suite.addTest(new TestFactory("testIE"));
	    suite.addTest(new TestFactory("testIEDir"));
	    suite.addTest(new TestFactory("testIETree"));
	    suite.addTest(new TestFactory("testIEFind"));
	    suite.addTest(new TestFactory("testIEMkdir"));
	    suite.addTest(new TestFactory("testIECopy"));
	    suite.addTest(new TestFactory("testIEMove"));
	    suite.addTest(new TestFactory("testIEDelete"));
	    suite.addTest(new TestFactory("testIEHelp"));
	    suite.addTest(new TestFactory("testIECD"));
	    suite.addTest(new TestFactory("testIEExit"));
	        
	    runner.doRun(suite);
	}
}
